#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <stack>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

void solve()
{
	ll n;
	cin>>n;
	vector<ll> v;
	v.push_back(1);
	v.push_back(2);
	ll num=2;
	while(num<n)
	{
		if(num*2> n) break;
		num*=2;
		v.push_back(num);
	}
	if(num==n)
	{
		cout<<v.size()<<endl;
		for(int i=v.size()-1;i>=0;i--) cout<<v[i]<<' ';
		cout<<endl;
	}
	else
	{
		ll cnt=num;
		while(num && cnt!=n)
		{
			num/=2;
			if(cnt+num<=n)
			{
				cnt+=num;
				v.push_back(cnt);
				
			}
		}
		cout<<v.size()<<endl;
		for(int i=v.size()-1;i>=0;i--) cout<<v[i]<<' ';
		cout<<endl;
	}
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

